{literal}
<h2>Annotation</h2>
@orm plugin DomArImage()<br>
<br>
Notice that DomArImage annotation can also take arguments that are user by DomArFile.

<h2>Methods</h2>
Useful image methods:<br>
<ul>
	<li><b>resize( Int $width, Int $height, Bool $inSize)</b> - Resizes image</li>
	<li><b>cut( Int $width, Int $height)</b> - Cuts image</li>
	<li><b>watermark( String $watermarkImagePath, array $settings)</b> - add watermark to the image. </li>
	<li><b>toPng</b> Converts image to PNG</li>
	<li><b>toGif</b> Converts image to GIF</li>
	<li><b>toJpg</b> Converts image to JPG</li>
</ul>
<br>

<h2>Resize</h2>
Resize method third argument "$inSize" explanation:<br />
<img src="{/literal}{$mediaUrl}{literal}DomAr/DomArImage/sample.png" /><br />
As you can see from the image:<br />
$inSize = true is good for usual resizing. <br />
$inSize = false is better when you need to cut some fixed size icon out from the original image. Usually next method call would be cut. See sample below.<br />

<h2> Sample usage </h2>
<pre class="code">
&lt;?php
class MySampleClass extends DomArObject {
	/**
	* @orm plugin DomArImage({autoRename=1})
	* @orm listener afterAdd afterAddImage
	*/
	protected $image;
	/**
	* @orm plugin DomArImage({autoRename=1})
	*/
	protected $icon;
	
	public function afterAddImage() {
		if( $this->image->exists() ) {
			$this->image->resize(800,600);
			
			// make 100x100px icon.
			$this->icon = $this->image->copy();
			$this->icon->resize(100,100,false);
			$this->icon->cut(100,100);
			
			// add watermark to middle of the image
			$this->image->watermark('PATH_TO_WATERMARK_IMAGE.png', array('location' => 'cc'));
		}
	} 
}

$sample = new MySampleClass();
// add image. It autmatically calls afterAddImage so it will also resize image, create icon and add watermark.
$sample->addExisting('path/to/someSampleImageFile');

// save object. It automatically renames file name. See DomArFile autoRename for more information about that.
$sample->save();

?&gt;
</pre>

{/literal}